package cn.luowenjie.faceclock.clock;

import androidx.appcompat.app.AppCompatActivity;

import android.media.MediaPlayer;
import android.os.Bundle;
import android.view.View;
import android.widget.Button;

import cn.luowenjie.faceclock.R;

public class FaceActivity extends AppCompatActivity {

    private MediaPlayer mediaPlayer;
    private Button button;

    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_face);
        mediaPlayer = mediaPlayer.create(this, R.raw.pig);
        button = findViewById(R.id.btn_close);
        mediaPlayer.start();
        //创建一个闹钟提醒的对话框,点击确定关闭铃声与页面
        button.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                mediaPlayer.stop();
                finish();
            }
        });
    }
}